<template>
	<view class="settlement">
		<view class="settlement-top">
			<view class="o-t-title">
				<image class="o-t-t-img" :src="imgUrl" mode="aspectFit"></image>
				<view class="o-t-t-con">
					<view>
						<text class="t-c-text">王经理</text>
						<text class="t-c-text">185****6757</text>
					</view>
					<text class="t-c-text1">西安市碑林区朱雀路中段1号</text>
				</view>
			</view>
			<view class="o-t-body">
				<uni-card title="张大姐" :extra="'2021-12-10 15:30:00'" :is-shadow="false" :border="false"
					:margin="'0 0 20rpx 0'" :spacing="'20rpx 40rpx'" :padding="0">
					<uni-list :border="false">
						<uni-list-item :border="false" v-for="obj in listData" :key="obj.id">
							<!-- 自定义 body -->
							<view slot="body" class="slot-box slot-main">
								<image class="slot-main-image" :src="obj.img" mode=""></image>
								<view class="slot-main-con">
									<view class="main-con">
										<text class="name">{{obj.name || ''}}</text>
										<view class="">
											<text class="money">￥</text>
											<text class="name">{{obj.money || '0.00'}}</text>
										</view>
									</view>
									<view class="main-con score">
										<text class="type">{{obj.type || ''}}</text>
									</view>
								</view>
							</view>
						</uni-list-item>
					</uni-list>
				</uni-card>
				<uni-card title="支付方式" :is-shadow="false" :border="false" :margin="'0 0 20rpx 0'" :spacing="'20rpx 40rpx'"
					:padding="0">
					<radio-group class="uni-list" @change="radioChange">
						<view class="sett-pay">
							<view class="seet-money">
								<image class="seet-img" :src="imgUrl2" mode="aspectFit">
								</image>
								<text class="seet-text">账户余额</text>
								<text class="seet-text seet-text1">（余额0元）</text>
							</view>
							<view>
								<radio style="transform:scale(0.7)" value="余额"></radio>
							</view>
						</view>
						<view class="sett-pay">
							<view class="seet-money">
								<image class="seet-img" :src="imgUrl3" mode="aspectFit">
								</image>
								<text class="seet-text">微信支付</text>
							</view>
							<view>
								<radio style="transform:scale(0.7)" value="微信"></radio>
							</view>
						</view>
					</radio-group>
				</uni-card>
			</view>
		</view>
		<view class="settlement-end">
			<view class="num">
				<text class="num-text">合计：</text>
				<text class="num-text num-text1">{{peace || '0.00'}}</text>
			</view>
			<button class="but-but" size="mini" @click="addClick()">立即支付</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				imgUrl:`${getApp().globalData.imgScr}jd/dizhi_xiangqiye.png`,
				imgUrl2:`${getApp().globalData.imgScr}jd/zhanghuyue.png`,
				imgUrl3:`${getApp().globalData.imgScr}bj/weixin.png`,
				peace: 0,
				listData: [{
					id: 1,
					img: `${getApp().globalData.imgScr}jd/fangxing.png`,
					name: '1802',
					money: 15.6,
					type: '标准间',
					checked: true,
				}, {
					id: 2,
					img: `${getApp().globalData.imgScr}jd/fangxing.png`,
					name: '1608',
					money: 13.6,
					type: '单人间',
					checked: true,
				}, {
					id: 3,
					img: `${getApp().globalData.imgScr}jd/fangxing.png`,
					name: '1205',
					money: 16.6,
					type: '单人间',
					checked: true,
				}],
				listVal: [],
				iocState: true,
				options1: [{ // 左滑动 操作按钮数据
					text: '删除',
					style: {
						backgroundColor: '#FF4B4B',
						color: '#ffffff'
					}
				}],
			}
		},
		onLoad(res) {
			console.log('选择的id',res)
			this.getData(res.pid)
			let sum = 0
			this.listData.forEach(item => {
				if (item.checked) {
					sum += item.money
				}
			})
			this.peace = sum.toFixed(2) * 1
		},
		methods: {
			/**
			 * 提交订单 按钮触发事件
			 */
			addClick: function() {
				// uni.switchTab({
				// 	url: '/hotelAdmin/tag/indent/indent'
				// })
			},
			/**
			 * 支付方式 选中项发生变化时触发 change 事件
			 * @param {Object} e e.detail = {value: 选中项radio的value}
			 */
			radioChange(e) {
			},
			/**
			 * 获取数据
			 * @param {Object} id  房间订单id,用,拼接 
			 */
			async getData(id) {
				let _this = this
				try{
					let res = await this.$http.post('/index/Hotelorder/pay_roomorder',{
						room_orderids:id,
					}) 
				}catch(e){
					//TODO handle the exception
					uni.showToast({
						title: e.errMsg,
						icon:"none"
					})
				}
			},
		}
	}
</script>

<style lang="scss">
	.settlement {
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		box-sizing: border-box;
		width: 100%;
		height: 100vh;
		padding-top: 20rpx;
		overflow: hidden;

		//内容区域样式
		.settlement-top {
			display: flex;
			flex-direction: column;
			flex: 1;
			margin-bottom: 20rpx;
			overflow: hidden;
			padding: 0 20rpx;

			// 顶部标题栏样式
			.o-t-title {
				display: flex;
				align-items: center;
				width: 100%;
				box-sizing: border-box;
				padding: 40rpx;
				margin-bottom: 20rpx;
				border-radius: 20rpx;
				background-color: #FFFFFF;
				overflow: hidden;

				.o-t-t-img {
					width: 44rpx;
					height: 44rpx;
					margin-right: 20rpx;
				}

				.o-t-t-con {
					flex: 1;
					display: flex;
					flex-direction: column;
					justify-content: center;

					.t-c-text {
						font-size: 28rpx;
						font-weight: 500;
						color: #000000;
						margin-right: 30rpx;
					}

					.t-c-text1 {
						font-size: 24rpx;
						font-weight: 500;
						color: rgba($color: #000000, $alpha: 0.7);
						margin-right: 30rpx;
					}
				}
			}

			// 中间 列表栏样式
			.o-t-body {
				flex: 1;
				overflow: auto;

				// 列表每一项内容的样式
				.uni-list-item__container {
					box-sizing: border-box;
					padding: 0 0 20rpx 0;
				}

				// 列表区域 自定义 header body 公共样式
				.slot-box {
					display: flex;
					align-items: center;
				}

				// 卡片公共样式
				.uni-card {
					border-radius: 20rpx;
					overflow: hidden;

					.uni-card__header {
						padding: 20rpx 0;

						.uni-card__header-content-title {
							font-size: 28rpx;
							font-weight: 600;
							color: #000000;
						}
					}

				}

				// 列表区域 自定义 body 的样式
				.slot-main {
					flex: 1;

					// 列表区域 图片样式
					.slot-main-image {
						width: 100rpx;
						height: 100rpx;
						border-radius: 20rpx;
						border: 0;
					}

					// 列表区域 详情信息 样式
					.slot-main-con {
						flex: 1;
						display: flex;
						flex-direction: column;
						margin-left: 16rpx;
						padding-right: 24rpx;

						.main-con {
							flex: 1;
							display: flex;
							justify-content: space-between;
							align-items: center;
							color: #000000;

							.name {
								font-size: 34rpx;
								font-weight: 500;
							}

							.money {
								font-size: 20rpx;
								font-weight: 500;
							}

							.type {
								font-size: 28rpx;
								font-weight: 500;
							}
						}



						.score {
							margin: 12rpx 0;
						}
					}
				}
			}
		}

		.uni-list {
			margin-bottom: 20rpx;
		}

		// 支付方式样式 
		.sett-pay {
			display: flex;
			justify-content: space-between;
			align-items: center;

			.seet-money {
				display: flex;
				align-items: center;
				margin-bottom: 20rpx;

				.seet-img {
					width: 38rpx;
					height: 38rpx;
					margin-right: 20rpx;
				}

				.seet-text {
					font-size: 24rpx;
					font-weight: 500;
					color: #000000;
				}

				.seet-text1 {
					color: rgba($color: #000000, $alpha: 0.4);
				}
			}
		}

		// 底部操作区域样式
		.settlement-end {
			display: flex;
			justify-content: space-between;
			align-items: center;
			box-sizing: border-box;
			width: 100%;
			padding: 40rpx;
			background-color: #ffffff;

			.num {

				.num-text {
					font-size: 32rpx;
					font-weight: 500;
				}

				.num-text1 {
					font-size: 38rpx;
					font-weight: 600;
					color: #DD524D;
				}
			}

			.but-but {
				line-height: 80rpx;
				border-radius: 40rpx;
				background: linear-gradient(-90deg, #8dc9f1, #d8eefc);
				font-size: 32rpx;
				color: #FFFFFF;
				margin: 0;
			}
		}
	}
</style>
